import Vue from "./index.js";
var vm = new Vue({
  el: "#app",
  data: {
    name: "yunhe达摩院",
    age: 16,
    school: "郑州大学",
    checked: true,
    selectIndex: 0,
    className: "bgRed",
    newObj: {
      a: 'newObjea'
    },
  },
  methods: {
    printData(...args) {
      console.log("args ==> ", args);
      this.name = "printData 修改了 name数据";
    },
  },
  // 组件
  components: {
    coms: {
      template: `
      <div>{{scopeSlot}}</div>
      `,
      data() {
        return {
          sonMsg: "son name is lyf",
        };
      },
    },
    // 插槽子组件
    "scope-slot": {
      template: `
      <div>
        <slot name="default" v-bind:slotKey="slotKey">
          <div>插槽默认</div>
        </slot>
      </div>
    `,
      data() {
        return {
          slotKey: "scope slot content",
        };
      },
    },
  },
  computed: {
    getAge() {
      console.log('getAge ==> Run')
      return this.age * 2;
    },
    getSchool(){
      console.log('getSchool ==> Run')
      return this.school + '是个211大学'
    }
  },
  // data 还可以使用闭包
  // data() {
  //   return {
  //     name: "yunhe达摩院",
  //     age: 16,
  //     school: '郑州大学'
  //   }
  // }
});

window.$vm = vm;

// 修改name
// setTimeout(() => {
//   vm.name = "name被修改了 并且触发了响应式更新";
// }, 3000);
